#include <iostream>
using namespace std;

void FillInc (int A[], int n);
void FillDec (int A[], int n);
void FillRand (int A[], int n);
void CheckSum (int A[], int n);
void RunNumber (int A[], int n);
void PrintMas (int A[], int n);

int main()
{
    int n = 1000;
    int A[n];
    FillInc(A, n);
    PrintMas(A, n);
    CheckSum(A, n);
    RunNumber(A, n);
    cout << endl;
    
    FillDec(A, n);
    PrintMas(A, n);
    CheckSum(A, n);
    RunNumber(A, n);
    cout << endl;
    
    srand(time(NULL));
    FillRand(A, n);
    PrintMas(A, n);
    CheckSum(A, n);
    RunNumber(A, n);
    
    return 0;
}

void FillInc (int A[], int n) {
    for (int i = 0; i < n; i++) {
        A[i] = i+1;
    }
}

void FillDec (int A[], int n) {
    for (int i = 0; i < n; i++) {
        A[i] = n-i;
    }
}

void FillRand (int A[], int n) {
    for (int i = 0; i < n; i++) {
        A[i] = rand();
    }
}

void CheckSum (int A[], int n) {
    long int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += A[i];
    }
    cout << "Сумма: " << sum << endl;
}

void RunNumber (int A[], int n) {
    //int k = 0;
    int r = 1;
    for (int i = 1; i < n; i++) {
        if (A[i-1] > A[i]) r++;
    }
    cout << "Серий: " << r << endl;
}

void PrintMas (int A[], int n) {
    for (int i = 0; i < n; i++) {
        cout << A[i] << " ";
    }
    cout << endl;
}

